package com.fanjun.androiddemo;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.fanjun.androiddemo.ui.BookActivity;
import com.fanjun.androiddemo.ui.SongActivity;
import com.fanjun.androiddemo.ui.UploadActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button book_list;
    private Button opt_demo;
    private Button upload_download;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        book_list = (Button) findViewById(R.id.book_list);
        opt_demo = (Button) findViewById(R.id.opt_demo);
        upload_download = (Button) findViewById(R.id.upload_download);

        book_list.setOnClickListener(this);
        opt_demo.setOnClickListener(this);
        upload_download.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.book_list:
                startActivity(new Intent(this, BookActivity.class));
                break;
            case R.id.opt_demo:
                startActivity(new Intent(this, SongActivity.class));
                break;
            case R.id.upload_download:
                startActivity(new Intent(this, UploadActivity.class));
                break;
        }
    }
}
